package com.bw.zg3park2212.merchant

import androidx.lifecycle.MutableLiveData
import com.bw.base.entity.MerchantAddParam
import com.bw.base.entity.MerchantEntity
import com.bw.base.entity.MerchantEntityItem
import com.bw.base.mvvm.BaseViewModel
import com.bw.base.net.ApiService
import dagger.hilt.android.lifecycle.HiltViewModel
import javax.inject.Inject

@HiltViewModel
class MerchantViewModel @Inject constructor(val apiService: ApiService): BaseViewModel(){
    val merchanSuccse=MutableLiveData<MerchantEntity>()
    fun getmerchan(){
        httpRequst(
            {apiService.getmerchant()},
            merchanSuccse::postValue
        )
    }
    var merchantxiangSuccse=MutableLiveData<MerchantEntityItem>()
    fun getmerchantxiang(id:Int){
        httpRequst(
            {apiService.getmerchantxiang(id)},
            merchantxiangSuccse::postValue)
    }
    var merchantnoSuccse=MutableLiveData<MerchantEntityItem>()
    fun getmerchantno(id:Int){
        httpRequst(
            {apiService.getmerchantju(id)},
            merchantnoSuccse::postValue)
    }
    var merchanaddSuccse=MutableLiveData<MerchantEntityItem>()
    fun getmerchanadd(merchantAddParam: MerchantAddParam){
        httpRequst(
            {apiService.getmerchantadd(merchantAddParam)},
            merchanaddSuccse::postValue)
    }
    var merchandelSuccse=MutableLiveData<Boolean>()
    fun getmerchandel(id:Int){
        httpRequst(
            {apiService.getmerchantdel(id)},
            merchandelSuccse::postValue)
    }
}